package org.lab.metricmodel;

import java.io.File;
import java.util.ArrayList;
import java.util.ResourceBundle;

public class FileDemo {
	
	public ArrayList<String[]> getMyFile(String xmlpath, String fileType){
//		File path = new File(req.getContextPath()+"\\WEB-INF\\classes\\pdmodel");// 鏌ヨ璺緞
		ResourceBundle resource = ResourceBundle.getBundle("xmlPath");
		String fileP = resource.getString(xmlpath);
		File path = new File(fileP);// 鏌ヨ璺緞
		File[] strList; // 瀛樻斁鎵�鏈夋煡璇㈢粨鏋�
		int i = 0;
		int num = 0;
		//String image;
		ArrayList list = new ArrayList();
		strList = path.listFiles(new MyFilter());
		for (i = 0; i < strList.length; i++) {
			if (strList[i].isDirectory()) { // 鍒ゆ柇鏄惁鏄洰褰�
				;
			} else {
				
				String[] fileN = strList[i].getName().replace('.', ':').split(":");
				if(fileType.equals(fileN[1].toLowerCase())){
					list.add(fileN);
				}
				
				num++;
			}
		}
		
		return list;
	}

	public static void main(String args[]){
		String name = "";
		ArrayList<String[]> list = new FileDemo().getMyFile("xmlPaths","xml");
		for(int i=0 ; i< list.size();i++){
			name = list.get(i)[0];
			String xml = list.get(i)[1];
			System.out.print(name+"."+xml);
		}
		
	}

}
